﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Configuration;

namespace iOak.Web
{
    public class BasePage : System.Web.UI.Page
    {
        private WorkAssistant _workassistant = new WorkAssistant();

        protected void Page_Init(object sender, EventArgs e)
        {
            //如果访问Administration下的页面
            if (Request.Url.AbsolutePath.IndexOf("/Administration") == 0)
            {
                //如果人员不是新区管委会的，则跳到登录页面
                Guid wndId = Guid.Parse(ConfigurationManager.AppSettings["wndId"]);
                if (!_workassistant.CurrentUser.CompanyId.Equals(wndId))
                {
                    FormsAuthentication.RedirectToLoginPage();
                }
            }
        }
    }
}